<template>
    <div id="cart">
        <nav-bar class="nav-bar">
            <div slot="center">购物车({{cartCount}})</div>
        </nav-bar>
        <cart-item-list :cartList="cartList" class="cart-list"></cart-item-list>
        <bottom-bar></bottom-bar>
    </div>
</template>

<script>
import NavBar from 'common/navbar/NavBar'
import CartItem from './childComps/CartItem'
import CartItemList from './childComps/CartItemList'
import BottomBar from './childComps/BottomBar'

import { mapState, mapMutations, mapActions, mapGetters } from "vuex"
export default {
    name: 'Cart',
    components: {
        NavBar,
        CartItem,
        CartItemList,
        BottomBar
    },
    computed: {
        // cartList () {
        //     return this.$store.state.cartList

        // },
        // cartCount () {
        //     return this.$store.getters.cartCount

        // }
        ...mapState(['cartList']),
        ...mapGetters(['cartCount'])
    }

}
</script>

<style  scoped>
#Cart {
    height: 100vh;
    background-color: #fff;
}
.nav-bar {
    background-color: var(--color-tint);
    font-weight: 700;
    color: #fff;
}
.cart-list {
    position: absolute;
    top: 44px;
    bottom: 49px;
    width: 100%;
}
</style>

